Skip to content

fix: logout button not working in profile dropdown#421

Merged
Xinecraft merged 1 commit into
developfrom
claude/logout-button-bug-y1a6wa
Jun 29, 2026
Merged

fix: logout button not working in profile dropdown#421
Xinecraft merged 1 commit into
developfrom
claude/logout-button-bug-y1a6wa

Conversation

@Xinecraft

@Xinecraft Xinecraft commented Jun 29, 2026

Copy link
Copy Markdown
Member

Problem

The logout button in the desktop profile dropdown did nothing when clicked.

Root cause

In ProfileDropdown.vue, logout relied on a native form submit:

<form @submit.prevent="emit('logout')">
  <jet-dropdown-link as="button" .../>  <!-- renders <button type="submit"> -->
</form>

This form lives inside reka-ui's NavigationMenuLink. When the submit button is clicked, NavigationMenuLink's click handler synchronously dispatches its rootContentDismiss event, which closes the dropdown. Vue flushes that DOM update in the microtask checkpoint that runs immediately after the click listener returns — unmounting the form before the browser performs the submit button's default action. So the form's submit event never fires, emit('logout') is never called, and the user is never logged out.

The mobile/responsive logout uses a plain form inside a Sheet (not a NavigationMenuLink), which is why it kept working — consistent with the reported symptom.

Fix

Trigger logout from a synchronous @click on the dropdown link instead of depending on the form-submit default action. The @click runs during click dispatch — before the menu unmounts — so emit('logout') reaches MainNavbarCustom's router.post(route('logout')) reliably.

<jet-dropdown-link as="button" btn-class="font-semibold" @click="emit('logout')">
  {{ __("Logout") }}
</jet-dropdown-link>

The event chain (ProfileDropdownNavDynamicItemMainNavbarCustom) is unchanged.

Testing notes

This is a client-side event-timing bug. The repo has no JS test harness (no Vitest/Jest) and the existing Pest feature tests can't reproduce a browser microtask-ordering issue, so no automated test was added. Verified by tracing the event flow against the bundled reka-ui NavigationMenuLink click handler.


The logout action relied on a native form submit (`<form @submit.prevent>`)
inside reka-ui's NavigationMenuLink. Clicking the submit button dispatches
NavigationMenuLink's rootContentDismiss, which closes the menu. Vue flushes
that DOM update in the microtask checkpoint that runs immediately after the
click listener returns, unmounting the form before the browser performs the
submit button's default action. As a result the form's submit event never
fired and logout never happened.

Trigger logout from a synchronous @click on the dropdown link instead, so
the emit runs during click dispatch (before the menu unmounts) rather than
depending on the form-submit default action.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vt4JQch9DkZubZT1ypJoDe
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ab72f425-acb3-47c1-8497-3ce7216f854a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@what-the-diff

what-the-diff Bot commented Jun 29, 2026

Copy link
Copy Markdown

PR Summary

  • Logout Process Simplified
    The logout process was originally triggered through a form submission method. This was replaced with a more straightforward click event method on the dropdown link. As a result, the need for a form element wrapper around the logout link was eliminated. This refactoring makes the logout process more intuitive and reduces web page clutter.

@Xinecraft Xinecraft merged commit 426a1f2 into develop Jun 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants